package com.tb.education.handler;

import com.tb.education.common.intf.AbsBaseHandler;
import com.tb.education.common.packets.DevicePacket;
import com.tb.education.common.packets.Head;
import com.tb.education.common.packets.Msg;
import com.tb.education.common.packets.response.TemperResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tio.core.ChannelContext;
import org.tio.core.Tio;

/**
 * 体温上传处理类
 *
 * @author wangze
 * @date 2020/07/13
 **/
public class TemperHandler extends AbsBaseHandler {


    private static Logger log = LoggerFactory.getLogger(TemperHandler.class);

    @Override
    public Object handler(DevicePacket packet, Head head, String requestBody, ChannelContext channelContext) throws Exception {
        //TODO 做一些体温相关操作
        log.info("体温为:" + requestBody);
        TemperResponse response = new TemperResponse();
        // 设置为0 正常
        response.setResponseStatus(0);
        DevicePacket resPacket = new DevicePacket();
        resPacket.setBody(Msg.getServerToClientByte(head, response));
        Tio.send(channelContext, resPacket);
        return null;
    }
}
